from django.utils.deprecation import MiddlewareMixin
from django.shortcuts import redirect

class AuthMiddleware(MiddlewareMixin):
    def process_request(self,request):
        if request.path_info in ['/manage/login/','/image/code/','/student/login/']:
            return
        info = request.session.get('info')

        if info:
            return
        return redirect('/student/login/')
    def process_response(self,request,response):
        return response

